Stress-controlled localization of deformation and fluid flow in fractured rocks