The decomposition of optimal transportation problems with convex cost