I have 2 images I am placing on top of a 1080X1920 canvas.

One is a rectangle that is 800x400 and it is sitting on the 1080X1920 canvas with top left coordinates of x=140 and y=1200

[![enter image description here](https://i.stack.imgur.com/OK08Y.png)](https://i.stack.imgur.com/OK08Y.png)

Then I have another image that is the same size of the canvas 1080X1920, but also has a rectangle on it at the exact same coordinates as the first rectangle. I am overlaying this 1080X1920 image at x=0 and y=0 on the canvas so that the rectangle already in this image lines up perfectly with the rectangle that is already placed on the canvas.

[![enter image description here](https://i.stack.imgur.com/aeNuz.png)](https://i.stack.imgur.com/aeNuz.png)

My problem is, I need to apply a rotation to both of these and the black and red rectangles need to match up in positioning AFTER the rotation is applied. Could be any rotation, but let's say it is a 15 degree rotation.

When each element is placed on the canvas and then the 15 degree rotation is applied, the rectangles no longer align because of the difference in image size and the offset in rotation as they both rotate around the center point which looks to be my only option in this case.

[![enter image description here](https://i.stack.imgur.com/3C86v.png)](https://i.stack.imgur.com/3C86v.png)

So I am hoping to sort out a formula I can use that would rectify the positioning of the 1080X1920 image so that the object already embedded in that image lines up with separately overlaid image.

There are of course other ways to deal with this problem, but right now, they would make things quite a bit more difficult, so I wanted to see if this was possible to calculate first.

I have tried several ways to calculate this, but am not super mathematically proficient, so I am grasping at straws at best.

Oh and because I am not extremely mathematically proficient, any dumbing-down of mathematical terms is appreciated. ;)

Oh and possibly this post answers this question, but I can't wrap my head around whether or not it does, so if someone can let me know if it does, I will try harder to understand and apply it to my particular case.

[How to recalculate the coordinates of a point after scaling and rotation?](https://stackoverflow.com/questions/49091198/how-to-recalculate-the-coordinates-of-a-point-after-scaling-and-rotation)