Huh. This is one of those words as to which I'd always subconsciously ascribed an etymology related to the phrase "on the rag". It is edifying to learn that the origin of the term is not known.