How to cut the square which tessellates to octagon using straightedge and compass? What are the exact measures of colored sides? What is the angle marked with red color?
Edit. Acknowledgement after answers.
Thanks to Jean Marie, Blue and Daniel Mathias for tackling the problem. I accepted Blue's answer for its breakthrough, but I also weighed Daniel Mathias' solution for its geometric simplicity. Initially, I didn't expect the problem to be so laborious. I invite you to my puzzle in a similar flavor of dissections, which after many years still has no answer nor proof that the solution does not exist. Variation of Haberdasher problem of Henry Dudeney - dissection of equilateral triangle into square with flipping pieces







$\newcommand{\cis}{\operatorname{cis}}$
To reduce fraction-clutter, I'll define $\pi_n := \pi/n$; also, I'll abuse notation to define $\cis\theta:=(\cos\theta,\sin\theta)$.
Importantly, in the octagon figure, the central square is rotated everso-slightly —just-under $2^\circ$— from being "axis-aligned". This complicates things a bit. (Or not: Skip to the Note for an uncomplicated discussion.)
Suppose the octagon has circumradius $r$, so that its sides have length $s:=2r\sin\pi_8= \sqrt{2-\sqrt{2}}$. Define points $P_k := r\,\cis k\pi_8$, for $k=0, 1, 2, \ldots, 7$; assigning OP's labels, we have $C:=P_0$ and $D:=P_1$; also, rotational symmetry in the square arrangement guarantees $|DE|=|BC|$, so that $B$ and $E$ are necessarily midpoints of segments $P_7P_0$ and $P_1P_2$, respectively.
The square arrangement also indicates that $|AF|=|CD|$, so that $|OF|=s/\sqrt{2}$. We can thus write $$F = \frac{s}{\sqrt2}\cis\theta \qquad A = \frac{s}{\sqrt2}\cis(\theta-\pi_2)$$ for some $\theta$ that makes $A$, $E$, $F$ collinear. With a calculational assist from Mathematica, I find that $\theta\approx46.9698^\circ$ satisfies:
$$\cos\theta = \frac12 \left(\sqrt2-1\right) \left(\sqrt{2 (4 + 3 \sqrt2)} - \sqrt{2-\sqrt2}\right)$$ (Refining this value is left as an exercise to the reader.) OP's "red angle" is given by $$\angle DEF = \frac12\cdot 135^\circ - (\theta-45^\circ) \approx 65.5302^\circ$$ Finally, we can write $$\frac{|AF|}{|AE|} = \frac{8 \sin\pi_8}{2 + \sqrt2 + 4\sqrt2 \sin\pi_8 \cos\theta} \approx 0.62588$$
Since all the expressions here involve sums, differences, products, and ratios of nested square roots, the dissection is straightedge-and-compass constructible. See Notes for constructions.
Note. Daniel Mathias helpfully demonstrates that, starting from the octagon itself, the construction of pentagon $ABCDE$ is dead-simple:
Let diagonals $P_1P_4$ and $P_2P_7$ meet at $I$, and let $\bigcirc O$ pass through $I$. Let the midpoint of $B$ and $E$ be $Q$, and let $\bigcirc Q$ pass through those points (and $O$). Then $A$ is the "lower" point where these circles meet (thanks to Thales' Theorem), and $F$ is the "other" point where line $AE$ meets $\bigcirc O$. (Verification is straightforward.)
Given that, we don't even need to know any lengths or angle-measures. Nevertheless, I'll give an easier derivation of the final ratio from my previous pass at this problem.
Let the sides of the octagon have lengths $2p$. Then we have $|AF|=|BC|=2p$ and $|BE|=2p+p\sqrt{2}=|AF|(1+\sqrt{2}/2)$. Recalling that $|EF|=|AB|$, we can invoke Pythagoras on $\triangle ABE$ thusly: $$ \begin{align} |AE|^2+(|AE|-|AF|)^2 = |BE|^2 &\quad\to\quad |AE| = |AF|\cdot\frac12 \left(1 + \sqrt{2 (1 + \sqrt2)}\right) \\[4pt] &\quad\to\quad \frac{|AF|}{|AE|}\approx 0.6255 \end{align}$$
Note 2. For a carpentry-friendly construction that starts with the square ...
Done!
Note 3. Here's a straightedge-and-compass construction of the point $B$ in the above figure.
Let $O$ be square's center, $M$ the midpoint of its right side, and $P$ its upper-right vertex.
For follow-along calculations, take $|MP|=1$ to be half the square's side-length. Fiddling with the radical ratios above, we find that we want to construct $B$ such that $$|MB|=\frac{1}{\sqrt{2(1+\sqrt{2})}}$$ (This comports with @DanielMathias' comment to the question.)
Transfer $P$ to $P'$ on the horizontal midline via rotation about $M$. $$|MP'| = 1$$
Transfer $P$ to $P''$ on the midline via rotation about $P'$. $$|MP''| = 1+\sqrt{2}$$
Transfer $M$ to $M'$ on the midline via rotation about $P''$. $$|MM'| = 2(1+\sqrt{2})$$
Transfer $M'$ to $M''$ on the side-line $MP$ via the semicircle with diameter $OM'$.
$$|MM''| = \sqrt{|MM'|} = \sqrt{2(1+\sqrt{2})}$$
Draw line $M''O$; along the perpendicular to this line at $O$, transfer $O$ to $B$ on the side-line. $$|MB| = \frac{1}{|MM''|} = \frac{1}{\sqrt{2(1+\sqrt{2})}}$$
Done!