The cam is driven in normal ways, with a helical gear cut internally in the cam gear.
The matching piece (with an externally cut gear) is mounted on straight splines on the end of the camshaft. All pieces are free floating (ie slide freely) withing each other. To stop the cam wheel just falling off,
it uses a pair of stoppers on the end of the cam to locate the wheel on the cam, while allowing the middle bit to do as it pleases.
As I hope you can visualise, when the cam wheel (for arguments sake this is the bit that is driven by the cam in this arrangement) is turned the cam turns. When you move the sliding middle piece lengthways the cam wheel and the camshaft are rotated relative to eachother (thanks to the combination of helical cut and straight splines).
This center piece has a moveable guide on it, not unlike the selector forks inside a gearbox, that has a linear cog (line with raised bits) on the back of it. This linear cog is moved by a worm drive. A worm drive is used because it is easily manufactured, cheap, and cannot be driven by whatever it is moving.
Because the moveable guide can only move in one direction, and it's position directly controls the phasing of the cam and wheel, it can easily have a linear potentiometer attached for direct measurement of the cam timing.
This all makes for a long camshaft, but one that easily allows on the fly timing changes.
Or did I just read some Toyota engineers mind from 3000km and 10 years ago?