This is far from the best solution... But if you have the points in consecutive order, call them a
, b
, c
, and d
with an x and a y field, you can use the cross product of the vectors between your point p
and each of the consecutive pairs.
If you always get the same sign for the result (i.e., all are positive or all are negative) then you're inside the rectangle; otherwise, you're outside.