How to shift down a square wave at 0 - 5 V?
One way is what's known as a data slicer.  A simple one, as shown below, requires the average value to be near the middle between the two levels.  That is true for a square wave.



Since the input voltage is 12-14 V, the comparator must be powered from a voltage enough above that so that the input signal is within its common mode range.

In this case, the comparator is assumed to have a open collector output.  That makes the output signal digital from ground to whatever voltage the pullup resistor (R2 in this example) goes to.

R1 and C1 form a low pass filter.  The comparator is therefore comparing the instantaneous input signal to somewhat of a average of recent history of the input signal.  Since that average will be half way between the high and low levels, this will work nicely.  This circuit automatically adjusts to drift of the high and low levels of the input signal.  The time constant of the filter is a tradeoff between being long enough to not react to the individual input pulses, but short enough to react to the drift in the digital levels.