Rotary valve with slide rails