Legendre polynomials and complex multiplication, I