This study examines the flow of dense granular materials under external shear stress and pressure using discrete element method simulations. In this method, the material is allowed to strain along all periodic directions and adapt its solid volume fraction in response to an imbalance between the internal state of stress and the external applied stress. By systematically varying the external shear stress and pressure, the steady rheological response is simulated for: (1) rate-independent quasi-static flow; and (2) rate-dependent inertial flow. The simulated flow is viscometric with non-negligible first and second normal stress differences. While both normal stress differences are negative in inertial flows, the first normal stress difference switches from negative to slightly positive, and second normal stress difference tends to zero in quasi-static flows. The first normal stress difference emerges from a lack of coaxiality between a second-rank contact fabric tensor and strain rate tensor in the flow plane, while the second normal stress difference is linked to an excess of contacts in the shear plane compared with the vorticity direction. A general rheological model of second order (in terms of strain rate tensor) is proposed to describe the two types of flow, and the model is calibrated for various values of interparticle friction from simulations on nearly monodisperse spheres. The model incorporates normal stress differences in both regimes of flow and provides a complete viscometric description of steady dense granular flows.