Assume two opposite vertices of a square are located on the side line AB of triangle ABC. Consider the orthic triangle HaHbHc. The construction is based on a property of point L - the intersection of AB and HaHb: the perpendicular to AB at L meets the remaining side lines AC and BC at the points Lb and La equidistant from L. Based on this property, the sought square has L as the center and Lb and La as two of the vertices. The remaining vertices that lie on AB can be now found quite easily.
If we sought two opposite vertices of the square on sides BC or AC, instead of AB we would have two additional points M and N as their centers. As a matter of fact, the three points L, M, and N are collinear. The line they lie on is known as the orthic axis of triangle ABC.
References
F. van Lamoen, Inscribed Squares, Forum Geometricorum, Volume 4 (2004) 207-214