The torsion problem for a nonconvex stored energy function