I have four points that form a rectangle, and I allow the user to move any point and rotate the rectangle by an angle (which rotates each point around a center point). It remains in the almost perfect shape of the rectangle (as far as the precision of PointF allows). Here is an example of my "rectangle", taken from four points:

However, I need to be able to get the width and height between the points. This is easy when the rectangle does not rotate, but after rotating it, my math returns the width and height indicated by the red outline:

Assuming I know the order of the points (e.g. clockwise, e.g. top to bottom), how do I get the width and height of the rectangle that they represent?
source share