I need a formula for a rectangle based on a rectangle like this:

Okay, so i have the black rectangle, from 0,0 to whatever xy size, and then i need a new rectangle over it (blue one) shaped based on the black one touching the angles, and to know the abcd positions. As shown in the picture.
I would be tons happy if someone can help me.

Notice that if you cut the blue rectangle along the sides of the black rectangle, the result is a dissection of the blue rectangle into a rectangle (the black one) and four right triangles.
If one angle of one of those right triangles is $45$ degrees, as shown, then the other acute angle of that triangle is also $45$ degrees, and so are all the acute angles of all the other triangles. In other words, once you choose the angle $45$ degrees, it results in four $45-45-90$ triangles.
In fact, the blue rectangle turns out to be a square whose diagonals are parallel to the sides of the black triangle. The vertices of the square are easy enough to find if you draw a graph. Suppose the black rectangle is parallel to the $x$ and $y$ axes with one corner at $(0,0)$ and the diagonally opposite corner at $(x,y)$, where $x > 0$ and $y > 0$, then the vertices of the blue triangle are:
$$A = \left( \frac x2, -\frac x2 \right)$$ $$B = \left( x + \frac y2, \frac y2 \right)$$ $$C = \left( \frac x2, y + \frac x2 \right)$$ $$D = \left( -\frac y2, \frac y2 \right)$$