Rule-based modulation of a sensorimotor transformation across cortical areas