"Square" was, indeed, a word used to indicate correctness, uprightness, and the like, as in "square deal" and "square meal" inter alia. Still has that meaning in most circles.

"Square" also means "conforming to norms, or standards", since it originally meant that it could be checked by means of the mason's or carpenter's square, as an ashlar or joist would be checked. It ought to mean that, since the Latin for "square" is "norma".

BTW, a little historical note. In my youth, ca. 1950's, there were two styles of dress for the boys. The one was the "greaser" look, like Fonzie on "Happy Days", with the long greased hair, the shirt/coat collar turned up in back and the favorite color combo of pink and black -- these guys were called "drapes." The other, opposite style, was the "squares", who had short hair, wore ties, button-down Oxford shirts, khakis, and sports coats. This was, believe it or not, in the days before anyone other than farmers or mechanics wore jeans.