I guess that I don't believe in "involuntary sins", hence my confusion about this subject.
Sin is not about breaking rules, but rather missing the mark. Masturbation is missing the mark, whether it happens intentionally in front of porn, or unintentionally in one's sleep. We miss the mark when we are not the humans God created us to be, and sometimes that happens whether we want it or not.
Does a monkey sin when it masturbates? Does a Chicken sin when it has its period?
Masturbation is an intentional act (even if it occurs in one's sleep, it is not a passive event), so it does not correlate with menstruation.
Animals cannot sin because they have no nous. They are "irrational beings". We don't look to the animals for our morality, because then we would have to accept polygamy, incest, murder, homosexuality, etc. We look to the Church for our morality, and to Christ.
Animals aren't sinful because they have no ability to consider their behavior. They act on their instincts, which are distorted by the fall and death, just as ours are. Unlike us, they have no higher function to govern themselves, so they do whatever comes to them.
God loves us, he knows we can't help it, and forgives us, of course. We need not despair over the sins we commit unawares. But it helps no one to say such things aren't sins, despite what the Church says. We confess them and move on, trusting that these things will be sorted out as we grow in holiness.
At least that's what my priest has said on the topic. I think it makes complete sense.