We need to remove the transform from the g element and apply it to the child elements.
test case
input:
<svg width="339px" height="237px" viewBox="0 0 339 237" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g stroke="none" stroke-width="0" fill="none" fill-rule="evenodd">
<g transform="translate(8.000000, 8.000000)">
<rect stroke="#979797" stroke-width="15.21" fill="#F7B9B9" x="0" y="0" width="151" height="93"></rect>
<ellipse stroke-opacity="0.546274038" stroke="#4D5490" stroke-width="10" fill="#94CFFA" cx="257" cy="49.5" rx="68" ry="49.5"></ellipse>
<rect stroke="#141414" stroke-width="10" fill="#ddd" opacity="0.696607013" x="49" y="133" width="150" height="90" rx="8"></rect>
<polygon stroke="#979797" stroke-width="5" fill="#DDB9FE" points="277 202 248.786308 216.832816 254.174644 185.416408 231.349287 163.167184 262.893154 158.583592 277 130 291.106846 158.583592 322.650713 163.167184 299.825356 185.416408 305.213692 216.832816"></polygon>
</g>
</g>
</svg>
output:
<svg width="338" height="236" viewBox="0 0 338 236" xmlns="http://www.w3.org/2000/svg">
<defs/>
<path fill="rgba(247,185,185,255)" fill-rule="evenodd" stroke="rgba(151,151,151,255)" stroke-width="15.21" d="M 8 8 L 159 8 L 159 101 L 8 101 Z"/>
<path fill="rgba(148,207,250,255)" fill-rule="evenodd" stroke="rgba(77,84,144,255)" stroke-opacity="0.546274038" stroke-width="10" d="M 333 57.5 C 333 84.83809511662 302.55536298849 107 265 107 C 227.44463701151 107 197 84.83809511662 197 57.5 C 197 30.16190488338 227.44463701151 8 265 8 C 302.55536298849 8 333 30.16190488338 333 57.5 Z"/>
<g opacity="0.696607013" transform="matrix(1 0 0 1 8 8)">
<path fill="rgba(221,221,221,255)" fill-rule="evenodd" stroke="rgba(20,20,20,255)" stroke-width="10" d="M 57 133 L 191 133 C 195.41827799865 133 199 136.58172200135 199 141 L 199 215 C 199 219.41827799865 195.41827799865 223 191 223 L 57 223 C 52.58172200135 223 49 219.41827799865 49 215 L 49 141 C 49 136.58172200135 52.58172200135 133 57 133 Z"/>
</g>
<path fill="rgba(221,185,254,255)" fill-rule="evenodd" stroke="rgba(151,151,151,255)" stroke-width="5" d="M 285 210 L 256.786308 224.832816 L 262.174644 193.416408 L 239.349287 171.167184 L 270.893154 166.583592 L 285 138 L 299.106846 166.583592 L 330.650713 171.167184 L 307.825356 193.416408 L 313.213692 224.832816 Z"/>
</svg>