This applet visually explains why a triangle is made up of parts of a rectangle.
This is a copy of Duane Habecker's work at https://www.geogebra.org/m/FwsnSVFB
The bug which causes errors when point B is more to the left of point A is eliminated by ensuring A is always more to the left of B.