The 19th century was a magnificent era of mechanical wonders. It was the time of Babbage’s differential engine and a time when Niepce created the first photograph. A time when Maxwell created the mathematical equations for the electrical and magnetic field paving way for Hertz to create microwaves in the lab.
Mechanical engineering was at its peak and many gears would calculate math formulas, or move your around or transform a rotating movement into translation on X or Y. The wonders of that era will stick with us for many years to come.
Check the video from below created by Ralph Steiner in 1930 about the mechanical principles. Square gears or triangle gears are definitively possible.