1540s, of multiplication, from square (adj.) + -ly (2). From 1560s as "in a straightforward manner;" meaning "firmly, solidly" is from 1860.
Entries linking to squarely
square adj.
early 14c., "containing four equal sides and right angles," from square (n.), or from Old French esquarre, past participle of esquarrer. Meaning "honest, fair," is first attested 1560s; that of "straight, direct" is from 1804. Of meals, from 1868.
Sense of "old-fashioned" is 1944, U.S. jazz slang, said to be from shape of a conductor's hand gestures in a regular four-beat rhythm. Square-toes meant nearly the same thing late 18c.: "precise, formal, old-fashioned person," from the style of men's shoes worn early 18c. and then fallen from fashion. Squaresville is attested from 1956. Square dance attested by 1831; originally one in which the couples faced inward from four sides; later of country dances generally.
[T]he old square dance is an abortive attempt at conversation while engaged in walking certain mathematical figures over a limited area. [The Mask, March 1868]
-ly 2
common adverbial suffix, forming from adjectives adverbs signifying "in a manner denoted by" the adjective, Middle English, from Old English -lice, from Proto-Germanic *-liko- (cognates: Old Frisian -like, Old Saxon -liko, Dutch -lijk, Old High German -licho, German -lich, Old Norse -liga, Gothic -leiko); see -ly (1). Cognate with lich, and identical with like (adj.).
Weekley notes as "curious" that Germanic uses a word essentially meaning "body" for the adverbial formation, while Romanic uses one meaning "mind" (as in French constamment from Latin constanti mente). The modern English form emerged in late Middle English, probably from influence of Old Norse -liga.