Points O,P,A,B,C,D may be moved to vary the figure.
Bug warning. If Q is left in coincidence with A or B, you'll be stuck with an ambiguity if you try to select it again
Proof of lemma. Let D be the origin of the complex plane. Triangle RQD is similar to a fixed triangle EAD. Thus R = cQ for some complex constant c. The lemma follows from linearity.
Proof of theorem. Name the vertices A,B,C so that AC separates D and B. Let E and F be the feet of perpendiculars on AB and BC respectively.
If ∠DCB = π/2, then ∠BAD = π/2 (inscribed quadrilateral), E coincides with A, F coincides with C, and the feet of the three perpendiculars all lie on AC.
Otherwise, without loss of generality, assume ∠DCB < π/2 < ∠BAD. Then F lies on the triangle side of AC, while E lies on the opposite side. Since ∠DCB +∠BAD = π = ∠BAD +∠DAE (inscribed quadrilateral; supplementary angles), ∠DCB = ∠DAE and triangle FCD is similar to EAD (and RQD). As Q moves from A to C, taking R from E to F, R must cross AC at some point G, which is the foot of the third perpendicular.
If the condition that DE, DF and DG meet the three sides at right angles is relaxed to "meet the three sides at equal angles", the proof still goes through.