what role does photosynthesis have in the cycling of matter into and out organsms