The Saturnian coorbital satellites Janus and Epimetheus present a unique dynamical configuration in the Solar System, because of high-amplitude horseshoe orbits, due to a mass ratio of order unity. As a consequence, they swap their orbits every 4 years, while their orbital periods is about 0.695 days. Recently, Tiscareno et al.(2009) got observational informations on the shapes and the rotational states of these satellites. In particular, they detected an offset in the expected equilibrium position of Janus, and a large libration of Epimetheus. We here propose to give a 3-dimensional theory of the rotation of these satellites in using these observed data, and to compare it to the observed rotations. We consider the two satellites as triaxial rigid bodies, and we perform numerical integrations of the system in assuming the free librations as damped. The periods of the three free librations we get, associated with the 3 dimensions, are respectively 1.267, 2.179 and 2.098 days for Janus, and 0.747, 1.804 and 5.542 days for Epimetheus. The proximity of 0.747 days to the orbital period causes a high sensitivity of the librations of Epimetheus to the moments of inertia. Our theory explains the amplitude of the librations of Janus and the error bars of the librations of Epimetheus, but not an observed offset in the orientation of Janus.