[tex]A=(cx+d)^2=c^2x^2+2cdx+d^2\\\\c^2x^2+2xcd+d^2=16x^2+40x+25\\\Downarrow\\c^2=16;\ 2cd=40;\ d^2=25\\\Downarrow\\c=\sqrt{16};\ cd=20;\ d=\sqrt{25}\\\Downarrow\\\boxed{c=4\ and\ d=5}\\\\The\ length\ of\ side:cx+d=\boxed{4x+5}\\\\The\ perimeter\ of\ the\ piece\ of\ fabric:4(4x+5)=\boxed{16x+20}\\\\For\ x=2:\\16\cdot2+20=32+20=\boxed{52}[/tex]