Cut Triangles into Rectangles & Dudeney's Puzzle Generalized

A quadrilateral can be dissected into a rectangle by a line joining the mid-points of one pair of opposite sides, and the perpendiculars to this line from the mid-points of the other pair of opposite sides (see http://www.geogebratube.org/student/m3459 ). In this applet, a triangle is dissected into 4 pieces by the 3 lines. Rotate the dissections, drag the red points to get a rectangle. CLICK any black SEGMENT to show/hide its LENGTH. Drag the Q to investigate its position at which the rectangle becomes a square (the generalized Dudeney's Puzzle).
Anthony Or. Education Bureau, Hong Kong.