As thingmaker3 has stated, you can use an active filter to remove all of the unwanted frqeuencies that make up the square-wave leaving the fundamental frequency. An active filter with a low-pass response should work fine if you need to preserve the DC component of the square wave. You can use a band-pass type active filter to block frequencies above and below the fundamental frequency if you need to eliminate the DC component of the original squarewave.