9

CJam, 180 ... 133 101 ... 94 90 87 bytes
qN/~'#/S*_,):L;]N*_,_,*{:A1$='#={[W1LL~)]Af+{W>},1$f=S&,{ASct}*}*}/N/z{S/{$W%}%'#*}%zN*
There is definitely lots of golfing possible, but I wanted to post it first after getting it to work completely.
Look ma! No scrollbars!
Takes the rocks grid (...