I have 2 rectangles that can scale in size. They both scale from there own center point. The blue rect can be positioned any where on the canvas.
After upscaling I get something like this.
However I want the blue rectangle to respect its original position relative to the red rectangle. So my question is what formula can I use to correct the blue rectangle position. The Image below reflects the corrected position.
The following values are given. The position(X), width(A) and height(B) of the red rectangle. The position(Y), width(C) and height(D) of the red rectangle.