Op-amp precision rectifiers are the likely turn-to solution. Here's an example circuit: -
When the input is positive, the op-amp is prevented from creating an inverted (negative) output by D1 but, when the input is negative, the natural situation is for a positive output to be produced and, of course, D1 allows this. D2 prevents output saturation of the op-amp when the input is positive i.e. keeps it in the linear region.
The circuit produces a positive half wave rectified output.
If the diodes are reversed then you get a half-wave rectified output when the input is positive and 0 volts when the input is negative. You can then add another inverting stage after this so that you get the polarity you require.
So, two precision op-amp circuits are needed and both are fed from \$V_{IN}\$. If you need to have a decent square wave output, add comparators to both output channels.