I’m looking forward mathematical or algorithmic calculation of rotating a rectangle with a fixed axis as a HINGE. As you can see in the below picture.
I have positions (x,y) of 4 points of rectangle vertices, and the origin is center of the rectangle, so the desired algorithm will project my original shape’s vertices into the desire shape vertices. (Please see image below)
I know it’s easy to do it with 3d libraries but i need to do it with 2d graphics in a high-level programming language like .Net or JAVA or something without any 3d or complementary library.
Please help me with any idea or reference or better than all a source code or algorithm.

Thanks in advance for you quality time.
Summarizing my comments above: