I have a rectangle. I know all sides and 4 points for it (see black rectangle below). I resize one edge of this rectangle to any point (see resized red color rectangle and new point B).

Here is the question. I can calculate the distance between A and B so they are known and center of this rectangle is known too (x,y). How to calculate catheti based on this?
(If this is not enough for solution, please tell me what else should be known to calculate sides)
Without loss of generality we may assume that $A=(0,0)$ and that the original black rectangle is aligned with the coordinate system.
Then the dimensions of the new red rectangle are $2|x|$ and $2|y|$.