12kHz sine or square. I can hear the difference - why?
Try synthesizing your “square wave” using only sinusoidal components below half the sample rate.  Otherwise, most of the infinite train of odd harmonics can alias to some other (lower) frequency in the sampled data.