Handle nested matrices correctly when drawing blend modes or transparency.

Closes #194.