Your guess is correct... you found the brass base of an antique doorknob with an inch or so of its broken square iron shaft. You can see those parts laid out in the doorknob-&-latch-parts photo below. The knob and base with the square hole are at upper right, and the square shaft is to the left of the knob.