Jorge Gracia and Lloyd Newton have an article on Medieval Theories of the Categories at SEP. It might be useful to give a slightly clearer summary of Aquinas's derivation of the categories than is found in the article.
It begins with predication. Predicates can do several things.
(1) The predicate can express what the subject is. This type of predicate falls into the category of substance.
(2) The predicate can express what inheres in a subject. It can do this (a) absolutely or (b) relatively.
(2a) If absolutely, it can indicate an inherence deriving from (1) matter or (2) form.
(2a1) If from matter, the predicate falls into the category of quantity.
(2a2) If from form, the predicate falls into the category of quality.
(2b) If relatively, the predicate falls into the category of to-another or relatedness.
(3) The predicate can express what does not inhere in a subject but is somehow relevant to it. This may be (a) wholly extrinsic; or (b) in some way intrinsic.
(3a) If wholly extrinsic, (1) we may be talking about something that measures the subject, or (2) we may not.
(3a1) If it measures the subject in some way, it may be a measurement according to (a) time; (b) place.
(3a1a) If time, the predicate falls into the category of when.
(3a1b) If place, the predicate may indicate (1) the parts of a subject in relation to each other, or (2) it may not.
(3a1b1) If so, the predicate falls under the category of situation or position.
(3a1b2) If not, the predicate falls under the category of where.
(3a2) If the predicate is wholly extrinsic but does not measure the subject, it falls within the category of vestment or habit (because things worn are the most obvious example of this category: 'being clothed' is an instance of habit or vestment).
(3b) If we are talking about something that is in some way intrinsic to the subject, we may be indicate (1) something done to the subject or (2) something done by the subject.
(3b1) If done to the subject, the predicate falls under the category of passion.
(3b2) If done by a subject, the predicate falls under the category of action.
Gracia and Newton make a big deal about how this requires an isomorphism between reality and language; but I'm not convinced of it. It's possible, for instance, that there may be predicates that look superficially like they belong in one category, but really belong in another. (For instance, 'undergoes' has a verbal form that usually suggests action; but it obviously falls under the category of passion.) What governs Aquinas's division is the way things are actually attributable to a thing; all this requires is that we can, in fact, attribute things to other things in a way that captures reality. That is, it does not require isomorphism, or even anything approaching it, but merely the ability to say things that are true about reality.