In this paper we address the problem of using quaternions in unconstrained nonlinear optimization of 3-D rotations. Quaternions representing rotations have four elements but only three degrees of freedom, since they must be of norm one. This constraint has to be taken into account when applying e. g. the Levenberg-Marquardt algorithm, a method for unconstrained nonlinear optimization widely used in computer vision. We propose an easy to use method for achieving this. Experiments using our parametrization in photogrammetric bundle-adjustment are presented at the end of the paper.