I have the following information:
A computer-generated Rectangle 1 with width=530 and height=686 and an upper-left-hand origin and positive values going right and down.
A computer-generated Rectangle 2 is inside Rectangle 1 with its upper-left-hand corner at (132,51) and width=159 and height=54.
When the computer rotates Rectangles 1/2, it results in Rectangle 3, a rectangle with width=787 and height=608
I was able to determine by external means that Rectangle 4 (formerly rectangle 2) now has an upper-left-hand-corner of (58,224) and width=63 and height=183.
How can I calculate the coordinates and dimensions of #4 above given only #1, #2, and #3?
Pictures of Rectangles 1/2 and 3/4 are shown below:


Reverse engineering
This is the original, with $(p,q)=(132,51)$ and $(a,b)=(159,54)$ within the rectangle $(w,h)=(530,686)$.First rotate counterclockwise over 90 degrees:
The new rectangle is $(W,H)=(787,608)$. So the scaling in x-direction is $\,W/h=787/686\,$ and the scaling in y-direction is $\,H/w=608/530\,$, but upon calculation they turn out to be the same, within the required accuracy (= one pixel).
Perform the scaling and round to integer values: $$ \begin{cases} P = q \times W/h = 59 & ; & Q = (w-a-p) \times H/w = 274 \\ A = b \times W/h = 62 & ; & B = a \times H/w = 182 \end{cases} $$