The rotation of erupting filaments in the solar corona is addressed through a parametric simulation study of unstable, rotating flux ropes in bipolar force-free initial equilibrium. The Lorentz force due to the external shear field component and the relaxation of tension in the twisted field are the major contributors to the rotation in this model, while reconnection with the ambient field is of minor importance. Both major mechanisms writhe the flux rope axis, converting part of the initial twist helicity, and produce rotation profiles which, to a large part, are very similar in a range of shear-twist combinations. A difference lies in the tendency of twist-driven rotation to saturate at lower heights than shear-driven rotation. For parameters characteristic of the source regions of erupting filaments and coronal mass ejections, the shear field is found to be the dominant origin of rotations in the corona and to be required if the rotation reaches angles of order 90 degrees and higher; it dominates even if the twist exceeds the threshold of the helical kink instability. The contributions by shear and twist to the total rotation can be disentangled in the analysis of observations if the rotation and rise profiles are simultaneously compared with model calculations. The resulting twist estimate allows one to judge whether the helical kink instability occurred. This is demonstrated for the erupting prominence in the Cartwheel CME on 9 April 2008, which has shown a rotation of approx 115 degrees up to a height of 1.5 R_sun above the photosphere. Out of a range of initial equilibria which include strongly kink-unstable (twist Phi=5pi), weakly kink-unstable (Phi=3.5pi), and kink-stable (Phi=2.5pi) configurations, only the evolution of the weakly kink-unstable flux rope matches the observations in their entirety.