Hello,
You can use the external interrups to do that. Just need two interrups
And increment or decrement an counter depending the way of move cw or ccw.
Remember that encoder ticks are 90º phase shifted.
Just attend the interruption in the transisitions os the signal.
After that, if you use an base time, you can calculate the speed of the motor as well with the position.
take in mind that you need to avoid the overflow of the counter, so the timming udes is important to calculate and put the result out. you just need to calculate the difference off ticks and related this with the radius of the wheel or the gearbox ratio you use for example.
For motor control recomend to use an PID with feed foward to elimibate the initial error in the integration part.
Regards