R.C.
I think it's important that everyone realize that this has nothing to with sexual stimulation. My pediatrician explained that it is a highly sensitive area but when they are rubbing that area they are not feeling what we think they are.
Imagine it this way, do you like it when someone tickles your arm or your back, or rubs your shoulders? Children discover a highly sensitive area that they can "feel" and react accordingly. It feels good but not in a sexual way, they don't even have the hormones for that feeling yet. This really helped me to deal with this.
I noticed that my little girl usually did this when she was bored or tired but then I connected it to a bowel movement. Whenever I saw her doing that I told her to run in and go to the bathroom and it turns out she was trying to hold her bowel movement.
The best advice is to not make a big deal out of it and distract them whenever they are doing it. My daughter is 4 and has pretty much stopped doing this. We tried not to react strongly and I always used the example of rubbing your arm if someone was at our home and saw her doing it. As adults we tend to think it is all linked sexually because they are sexual parts, if you alter your thinking it will be less offensive to you and your toddler will adjust easier.