Descartes and Material Substance

In the sixth of his Meditations, Descartes is primarily concerned with proving the distinctness of body and mind. In order to do so he must demonstrate that bodies and mind differ in their essential characteristics. And it is in this Meditation that we learn the famous Cartesian definition of the essential quality of material substance: they are extended things. That is to say, material substances essentially have size, shape, and motion. Any other qualities we may attribute to any given material substance - color, for example - is not an essential characteristic. Anything that is a material substance has extension, and any other quality a material substance may have is irrelevant to its being a material substance.
Although the demonstration for his view of material substance is contained in Meditation six, the conclusion is pre-determined much earlier. In the very first Meditation, Descartes makes the crucial distinction between primary objects - those of mathematics - and secondary objects - those of sense. Corresponding to these are the primary and secondary qualities. Primary qualities are quantity, shape, and magnitude; secondary qualities are those which are perceived by the senses. As such, for Descartes, those things that we might typically think of as essential to matter - solidity, color, etc. - cannot be. Only extension is essential to material substance.
Without the distinction between primary and secondary qualities we can make no more sense of extension being the essence of material substance than we can of indivisibility. But there is at least an a priori case for Descartes's distinction. I might have some trouble imagining a colorless rock, but it is impossible for me to imagine an unextended rock. Leibniz's parallel insistence of the indivisibility of the truly real, in contrast, seems simply doctrinal. I have no trouble imagining something being infinitely divisible and yet still real, something that is perhaps reinforced by discoveries of modern physics.