We perform a nonperturbative lattice calculation of the P-wave pion-pion scattering phase in the ρ-meson decay channel using two flavors of maximally twisted mass fermions at pion masses ranging from 480 to 290 MeV. Making use of finite-size methods, we evaluate the pion-pion scattering phase in the center-of-mass frame and two moving frames. Applying an effective range formula, we find a good description of our results for the scattering phase as a function of the energy covering the resonance region. This allows us to extract the ρ-meson mass and decay width and to study their quark mass dependence.