Points $E$, $F$, $G$, and $H$ lie inside a rhombus $ABCD$, such that the triangles $\triangle AEB$, $\triangle BHC$, $\triangle CGD$, and $\triangle DFA$ are isosceles right triangles with hypotenuses $AB$, $BC$, $CD$, and $DA$. The sum of areas of $ABCD$ and $EFGH$ is $S$. Find, with the proof, the length of $CD$. Express your answer in terms of $S$ only.
I know the area of the rhombus $\left( \frac12 d_1d_2 \right)$ and I know the four triangles are equivalent and can find their areas to subtract from $ABCD$. I'm unsure how to go about finding the remaining area (four triangles) to get the area of $EFGH$. My approach could be wrong though.


WARNING: NOT RIGOROUS (intended to walk someone through how a proof would be constructed in an environment more conducive to diagrams).
First, we note that if $ABCD$ is a square, then $EFGH$ collapses to a single point at the center. Let $\theta$ be the the smaller angle of the rhombus $ABCD$ and $x=CD$ be its side length. We see that $EFGH$ is a square since $$|EF|=|FG|=|GH|=|HE|=2\frac{x}{\sqrt{2}}\sin\left(\frac{\theta-\frac{\pi}{2}} {2}\right)$$ and the perpendicular bisectors of $EF$ and $GH$ are themselves perpendicular. Hence $$EFGH=2x^2\sin^2\left(\frac{\theta-\frac{\pi}{2}}{2}\right)=x^2(1-\sin(\theta))$$ $ABCD$ can similarly be expressed in terms of $\theta$ and $x$. Let the longer side of the rhombus be $d_1$, the shorter $d_2$. Then $d_1=2x\cos\left(\frac{\theta}{2}\right)$ and $d_2=2x\sin\left(\frac{\theta}{2}\right)$. Therefore $$ABCD=\frac{1}{2}\left(4x^2\left[\cos\left(\frac{\theta}{2}\right)\sin\left(\frac{\theta}{2}\right)\right]\right)=x^2\sin(\theta)$$ and $S=x^2$.