A quadrature encoder uses two output channels offset in phase to detect both direction and position with greater precision.
There’s more to making an oscillator than meets the eye, and [lcamtuf] is here with a good primer on the subject. It starts ...