I found an answer for Blender Internal engine at I want to make a projector show an image displayed on surfaces
But I want to accomplish something similar in Cycles. I tried attaching a texture node to the lamp's node tree, but it seems the color pattern is based on the world coordinates and does not rotate with the spot lamp.
What is the correct node setup for a cycles lamp so that its texture rotates and moves with the lamp?