Flexible rod model for the rotation of a drill string in an arbitrary borehole