Recombination, selection, and the evolution of tandem gene arrays