I am stuck with trying to find the area of the rectangle $A$ as a function of $x$:

(Drawing replicated from my textbook, not sure if more labels would be helpful?)
Obviously $A$ is given by the product of two adjacent rectangle sides, one of which is equal to the hypotenuse of the bottom-left inner triangle. The hypotenuse in turn is given by the Pythagorean relation $\sqrt{x^2+y^2}$, if we let $y$ be equal to $b$ minus the hypotenuse of the upper-left inner triangle.
I have tried doing some algebra from there, but I am unable to eliminate all the variables I believe I am supposed to. Am I correct that the final expression may take the outer triangle as given, but otherwise should only depend on $x$?
Any hints as to which (geometric?) relations I may be missing out on? Or similar problems posted here earlier that I should take a more thorough look at?
(I have seen similar problems discussed on this site, but not with the rectangle in this position. Also, similar problems I have seen tend to include some numbers and not just general quantities, which in my experience is a bit easier to wrap my mind around. The next step of the task is to optimize the area of the inscribed rectangle, but that should be simple enough once I have the formula worked out.)
