The trackball works like a
mechanical mouse.
Further details and better pictures
here and there's an explanation of quadrature waveforms
here.
You'll need an
optical encoder like the one Keilmillerjr mentions. (other encoder options at link)
There are 4 wires per axis leading to the encoder:
1. 5v - operating voltage for the LED
2. Data A
3. Data B
4. Ground (Sometimes jumpered inside the trackball case, leaving one axis with only 3 wires)
By swapping Data A for Data B, you are swapping quadrature waveform A for waveform B which the encoder translates as turning the other way.

The green optical boards are the older style but no need to replace them if they are working OK.
If/when the green boards go bad, replace them with the newer red boards.
Scott