Thus mountains made of granite weather into sand grains made of quartz and clays. Sand grains are heavier than clays, and clays thus tend to get carried further by water before they sink to the bottom. Thus the edges of continents tend to get accumulations of sand, while areas offshore tend to get accumulations of mud. All through this process, animals that build their skeletons of calcium carbonate die and add their shells to the sediment, but only very far from the source areas of the sand and clay can deposits made up just of animal skeletons form. Such deposits made mostly from calcium carbonate form limestones.
Sedimentary rocks tend to form a gradient of grain size and composition.
If you take existing rocks, bury them, and expose them to heat an pressure, they get cooked into other rocks. Chemical reactions take place, and mineral grains grow. The basic proccess involved in the formation of metamorphic rocks is that in rocks exposed to heat and pressure, but not enough heat enough to melt, mineral grains start to grow. Start, for example, with a clay. Heat and pressure turn it into a shale.