Processing shortcodes in groups (separated by line breaks)?

I think it is easier to introduce the shortcode [imgs] that could be used like this:

 [imgs id="12,13,14" w="200,300,400" h="300,400,500"]
 [imgs id="19,20" w="50,60" h="80,100"]

then you can explode each attribute with respect to comma (,) and loop over corresponding array.