In any right-angled triangle, the area of the square whose side is the hypotenuse (the side opposite the right angle) is equal to the sum of the areas of the squares whose sides are the two legs (the two sides that meet at a right angle).
c2 = Area(red square) = (a + b)2 - 4 * (ab / 2)
c2 = a2 + 2ab + b2 - 2ab
c2 = a2 + b2
The total area of white does not change as the coloured triangles move within the large square, so the large white area equals the total of the two smaller ones. The three areas are quadrilaterals, with the correct length of sides and the two smaller ones have a right angle, and the figure with the large white area is symmetric under a right angle rotation, so it too is a square.