And most of the popular camera extensions like RenderCam or Orthographic have helper functions to translate camera position to world position of your mouse position.
Here is a simple rectangle collision check for seeing if a point is withina rectangle that assumes the center of the rectangle object is at its 0,0 point and expands outward evenly.
local function point_within_rectangle_centroid(point_x, point_y, rectangle_x, rectangle_y, rectangle_width, rectangle_height)
local width_half = rectangle_width / 2
local height_half = rectangle_height / 2
if point_x >= (rectangle_x - width_half) and point_x <= (rectangle_x + width_half) then
if point_y >= (rectangle_y - height_half) and point_y <= (rectangle_y + height_half) then
return true
end
end
return false
end