I think this is a simple problem but my Math/Geometry skills are not very good.
I am given the top,left coordinates and the height & width of a rectangle as input. Using this I plot the rectangle inside a larger one, using the top, left coordinates of the inside (smaller) rectangle as an offset from the top, left of the larger rectangle.
Let the unit of measurement be pixels. So if the top,left coordinates are (0,0) for the lower rectangle it means it is also starting at the same exact coordinate as the larger one. I then draw them till height,width pixels. If the coordinates are (100,50) then it means that smaller rectangle starts 100px to the right and 50px lower to the top of the top, left of the larger rectangle, etc. I hope you get the point.
Now I am having an additional fifth input point which is the rotation angle for the smaller rectangle. So suppose I have as top, left values (10,5) and a rotation angle value of 45 for the smaller rectangle. This now means that my smaller rectangle should now be rotated at clockwise 45 degress, whereby the rectangle now will now no longer be parallel to the ground. How to I calculate the necessary top, left coordinate in order to draw this rotated rectangle?