This question is similar to another one about axis-aligned rectangles. However, I specifically want to calculate this for rotated rectangles.
I have a rectangle with a (cx, cy) for the center point and a width, and height, and a (x, y) for the test point, as well as a θ for the angle of rotation.
What's the fastest way to determine the distance between that point, and the nearest edge of the rectangle? If the point is inside the rectangle, the distance should be zero.
I believe that there is going to be only a small change to the equation in the linked question, but I have no idea what it might be.