Rates of convergence for alternating projections